<?php

use think\migration\Migrator;

class SupplyUser extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table  =  $this->table('supply_user',array('engine'=>'InnoDB'));
        $table->addColumn('openid', 'string',array('limit' => 200,'comment'=>'微信id')) 
            ->addColumn('grade', 'integer',array('default'=>1,'comment'=>'级别'))
            ->addColumn('nickname', 'string',array('limit'=>50,'default'=>'测试'.time(),'comment'=>'昵称'))
            ->addColumn('head_img', 'string',array('null'=>true,'limit' => 200,'comment'=>'头像'))
            ->addColumn('create_time', 'integer',array('default'=>time(),'comment'=>'创建时间'))
            ->addColumn('update_time', 'integer',array('default'=>0,'comment'=>'更新时间'))
            ->addColumn('delete_time', 'integer',array('null'=>true,'comment'=>'删除时间'))
            ->create();
    }
}
